<?php

namespace plugin\admin\app\model;

use plugin\admin\app\model\Base;

/**
 * @property integer $id 主键(主键)
 * @property string $created_at 创建时间
 * @property string $updated_at 更新时间
 * @property string $name 设备名称
 * @property string $sn 设备编号
 * @property string $gateway_id 网关ID
 * @property string $mold_number 膜件号
 * @property string $customer_name 客户名称
 * @property string $customer_phone 客户电话
 * @property string $customer_province 客户所在省
 * @property string $customer_city 客户所在市
 * @property integer $status 开关机状态
 * @property integer $is_online 在线状态
 * @property string $cl 余氟
 * @property string $ph PH值
 * @property integer $tds 水质
 * @property integer $alarm 报警码
 * @property integer $filter 滤芯寿命
 * @property string $water 累计产水量
 * @property integer $last_send_at
 */
class Device extends Base
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'wa_devices';

    /**
     * The primary key associated with the table.
     *
     * @var string
     */
    protected $primaryKey = 'id';
    
    public function users(){
        return $this->belongsToMany(User::class,'wa_device_user','device_id','user_id');
    }
    
}
